<template>
	<view>
		<view class="item" v-for="(item, index) in multilData" :key="index" @tap="toDetail(item)">
			<view class="title text-ellipsis">{{item.newsTitle}}</view>
			<view class="content flex-row">
				<view class="info">
					<view class="summary">{{item.newsContent}}</view>
					<view class="flex-row">
						<text class="date">{{item.publishDay}}</text>
						<text class="views">{{item.redCount}}</text>
					</view>
				</view>
				<!-- https://img.bugela.com/uploads/2021/07/13/49048720df42d8396274214fad730c8b.jpg -->
				<view class="cover">
					<image class="img" :src="item.logoImg"></image>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			multilData: {
				type: Array,
				default: () => {
					return [];
				}
			},
		},
		methods: {
			toDetail(data) {
				uni.navigateTo({
					url:'/pages/news/newsDetail?id=' + data.id
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	// 多行文本截取
	@mixin text-ellipsis($clamp) {
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: $clamp;
		-webkit-box-orient: vertical;
	}

	.item {
		padding: 20rpx 30rpx;
		background-color: #FFFFFF;
		height: 220rpx;

		.title {
			font-weight: bold;
			padding-bottom: 10rpx;
		}

		.flex-row {
			display: flex;
			flex-direction: row;
			align-items: center;
			justify-content: space-between;
		}

		/*文本截取*/
		.text-ellipsis {
			overflow: hidden;
			text-overflow: ellipsis;
			white-space: nowrap;
		}

		.content {
			padding-top: 10rpx;
			align-items: flex-start;

			.info {
				width: calc(100% - 160rpx);

				.summary {
					color: #777;
					height: 80rpx;
					font-size: 24rpx;
					line-height: 1.6;
					margin-bottom: 10rpx;
					@include text-ellipsis(2);
				}

				.date {
					font-size: 24rpx;
					color: #999;
					opacity: 0.6;
				}

				.views {
					color: #999;
					font-size: 24rpx;
				}
			}

			.cover {
				width: 140rpx;
				height: 120rpx;

				.img {
					width: 100%;
					height: 100%;
					border-radius: 15rpx;
				}
			}
		}
	}
</style>
